﻿package mortal.game.view.guild.otherpanel
{
    import com.mui.controls.*;
    import extend.language.*;
    import fl.data.*;
    import flash.events.*;
    import mortal.common.global.*;
    import mortal.component.window.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.view.common.*;
    import mortal.game.view.guild.cellrender.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class GuildResourceAllotTipPanel extends SmallWindow
    {
        private var _list:GTileList;
        private var _confirmBtn:GButton;
        private var _cancelBtn:GButton;
        private static var _instance:GuildResourceAllotTipPanel;

        public function GuildResourceAllotTipPanel(param1:ILayer = null)
        {
            super(param1);
            setSize(270, 240);
            title = Language.getString(70522);
            return;
        }// end function

        private function onConfirm(event:MouseEvent) : void
        {
            this.hide();
            return;
        }// end function

        private function onCancel(event:MouseEvent) : void
        {
            this.hide();
            return;
        }// end function

        public function set data(param1:Array) : void
        {
            this._list.dataProvider = new DataProvider(param1);
            this._list.drawNow();
            return;
        }// end function

        override public function hide() : void
        {
            super.hide();
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildResourceSelectItemUpdata));
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            pushUIToDisposeVec(UIFactory.gTextField(Language.getString(70523), 14, 36, 220, 20, this));
            pushUIToDisposeVec(UIFactory.gTextField(Language.getString(70524), 14, 55, 120, 20, this, GlobalStyle.textFormatBai.center()));
            pushUIToDisposeVec(UIFactory.gTextField(Language.getString(70525), 134, 55, 65, 20, this, GlobalStyle.textFormatBai.center()));
            pushUIToDisposeVec(UIFactory.gTextField(Language.getString(70526), 199, 55, 65, 20, this, GlobalStyle.textFormatBai.center()));
            this._list = UIFactory.tileList(14, 55, 260, 158, this);
            this._list.setStyle("cellRenderer", GuildResourceAllotTipRenderer);
            this._list.columnWidth = 260;
            this._list.rowHeight = 25;
            this._confirmBtn = UIFactory.gButton(Language.getString(70527), 80, 213, 49, 24, this);
            this._cancelBtn = UIFactory.gButton(Language.getString(70528), 155, 213, 49, 24, this);
            this._confirmBtn.configEventListener(MouseEvent.CLICK, this.onConfirm);
            this._cancelBtn.configEventListener(MouseEvent.CLICK, this.onCancel);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._list.dispose(param1);
            this._confirmBtn.dispose(param1);
            this._cancelBtn.dispose(param1);
            this._list = null;
            this._confirmBtn = null;
            this._cancelBtn = null;
            return;
        }// end function

        public static function get instance() : GuildResourceAllotTipPanel
        {
            if (_instance == null)
            {
                _instance = new GuildResourceAllotTipPanel;
            }
            return _instance;
        }// end function

        public static function get isShow() : Boolean
        {
            return _instance && !_instance.isHide;
        }// end function

    }
}
